package com.haoshuang.zhouzhoubang.ui.page.mine.wallet.frozen.record

import com.haoshuang.zhouzhoubang.databinding.ItemForzenDayGroupBinding
import com.haoshuang.zhouzhoubang.model.bean.DepositGroupByDayBean
import com.mufeng.libs.base.BaseBindingHolder
import com.mufeng.libs.base.BaseBindingQuickAdapter
import com.mufeng.libs.utils.view.vertical


/**
 *
 */
class ForzenDayGroupAdapter(
    data: MutableList<DepositGroupByDayBean.DepositGroupBean>,
    private val onClick: (item: DepositGroupByDayBean.DepositGroupBean.DepositBean?, position: Int) -> Unit
) : BaseBindingQuickAdapter<DepositGroupByDayBean.DepositGroupBean, ItemForzenDayGroupBinding>(data) {

    override fun onBindViewHolder(
        holder: BaseBindingHolder,
        position: Int,
        item: DepositGroupByDayBean.DepositGroupBean?
    ) {
        holder.getViewBinding<ItemForzenDayGroupBinding>().apply {
            tvDate.text = item?.add_date

            val adapter = ForzenAdapter(item?.list?.toMutableList() ?: mutableListOf())
            recyclerView.vertical()
                .adapter = adapter

            adapter.setOnItemClickListener { _, view, position ->
                val i = adapter.getItem(position)
                onClick(i, position)
            }

        }
    }


}
